package set;

import org.junit.Test;

import java.util.HashSet;
import java.util.LinkedHashSet;

/**
 * HashSet和LinkedHashSet
 */
public class SetTest {
    @Test
    public void test() {
        HashSet<String> set = new HashSet<>();
        // private static final Object PRESENT = new Object();

        //    public boolean add(E e) {
        //        return map.put(e, PRESENT)==null;
        //    }

        set.add("A");
    }

    @Test
    public void testLinkedHashSet() {
        //    public LinkedHashSet() {
        //        super(16, .75f, true);
        //    }
        LinkedHashSet<String> linkedHashSet = new LinkedHashSet<>();

        //    public boolean add(E e) {
        //        return map.put(e, PRESENT)==null;
        //    }
        linkedHashSet.add("S");

    }
}
